/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package interfaces;

import datos.Administrador;
import java.awt.BorderLayout;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import negocios.GestorEstadisticas;

/**
 *
 * @author miguesaca
 */
public class Panel_Inicio extends JPanel {

    /**
     * Creates new form Panel_Inicio
     */
    public Panel_Inicio() {
        initComponents();
    }

    public void inicio() {
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        boton_CallCenter = new javax.swing.JButton();
        boton_SOS = new javax.swing.JButton();
        boton_Gestion = new javax.swing.JButton();
        boton_Login = new javax.swing.JButton();

        setBackground(new java.awt.Color(0, 0, 0));

        boton_CallCenter.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon_center1.png"))); // NOI18N
        boton_CallCenter.setBorderPainted(false);
        boton_CallCenter.setContentAreaFilled(false);
        boton_CallCenter.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        boton_CallCenter.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        boton_CallCenter.setIconTextGap(-3);
        boton_CallCenter.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon_center2.png"))); // NOI18N
        boton_CallCenter.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon_center0.png"))); // NOI18N
        boton_CallCenter.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        boton_CallCenter.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        boton_CallCenter.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                boton_CallCenterMousePressed(evt);
            }
        });
        boton_CallCenter.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                boton_CallCenterMouseMoved(evt);
            }
        });

        boton_SOS.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon_sos1.png"))); // NOI18N
        boton_SOS.setBorderPainted(false);
        boton_SOS.setContentAreaFilled(false);
        boton_SOS.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        boton_SOS.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        boton_SOS.setIconTextGap(-3);
        boton_SOS.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon_sos2.png"))); // NOI18N
        boton_SOS.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon_sos0.png"))); // NOI18N
        boton_SOS.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        boton_SOS.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        boton_SOS.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                boton_SOSMouseMoved(evt);
            }
        });

        boton_Gestion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon_gestion1.png"))); // NOI18N
        boton_Gestion.setToolTipText("");
        boton_Gestion.setBorderPainted(false);
        boton_Gestion.setContentAreaFilled(false);
        boton_Gestion.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        boton_Gestion.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        boton_Gestion.setIconTextGap(-3);
        boton_Gestion.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon_gestion2.png"))); // NOI18N
        boton_Gestion.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon_gestion0.png"))); // NOI18N
        boton_Gestion.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        boton_Gestion.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        boton_Gestion.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                boton_GestionMouseMoved(evt);
            }
        });
        boton_Gestion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boton_GestionActionPerformed(evt);
            }
        });

        boton_Login.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon_modificar1.png"))); // NOI18N
        boton_Login.setBorderPainted(false);
        boton_Login.setContentAreaFilled(false);
        boton_Login.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        boton_Login.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        boton_Login.setIconTextGap(-3);
        boton_Login.setPreferredSize(new java.awt.Dimension(50, 50));
        boton_Login.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon_modificar2.png"))); // NOI18N
        boton_Login.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon_modificar0.png"))); // NOI18N
        boton_Login.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boton_LoginActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(boton_Login, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(boton_SOS, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(boton_CallCenter, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(boton_Gestion, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 4, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(boton_Login, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(60, 60, 60)
                .addComponent(boton_SOS, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(boton_CallCenter)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(boton_Gestion)
                .addContainerGap(100, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private Panel_CallCenter panel_CallCenter;
    private Panel_SOS panel_SOS;
    private JPanel panel_Escritorio;
    private Panel_Gestion panel_Gestion;
    private Panel_Login panel_Login;

    public void setPanel_Gestion(Panel_Gestion panel_Gestion) {
        this.panel_Gestion = panel_Gestion;
    }

    public void setPanel_Escritorio(JPanel panel_Escritorio) {
        this.panel_Escritorio = panel_Escritorio;
    }

    public void setPanel_Center(Panel_CallCenter panel) {
        this.panel_CallCenter = panel;
    }

    public void setPanel_SOS(Panel_SOS panel_SOS) {
        this.panel_SOS = panel_SOS;
    }

    public void setPanel_Login(Panel_Login panel_Login) {
        this.panel_Login = panel_Login;
    }

    private void boton_CallCenterMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boton_CallCenterMouseMoved
        // TODO add your handling code here:
        if (!panel_Login.isVisible()
                && (panel_Login.getClaseUsuario().equalsIgnoreCase(Administrador.class.getName()))) {
            panel_Escritorio.add(panel_CallCenter, BorderLayout.CENTER);
            panel_Gestion.setVisible(false);
            panel_SOS.setVisible(false);
            panel_CallCenter.setVisible(true);
        }


    }//GEN-LAST:event_boton_CallCenterMouseMoved

    private void boton_SOSMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boton_SOSMouseMoved
        // TODO add your handling code here:
        if (!panel_Login.isVisible()) {
            panel_Escritorio.add(panel_SOS, BorderLayout.CENTER);
            panel_CallCenter.setVisible(false);
            panel_Gestion.setVisible(false);
            panel_SOS.setVisible(true);
        }

    }//GEN-LAST:event_boton_SOSMouseMoved

    private void boton_GestionMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boton_GestionMouseMoved
        // TODO add your handling code here:
        if (!panel_Login.isVisible()) {
            panel_Escritorio.add(panel_Gestion, BorderLayout.CENTER);
            panel_CallCenter.setVisible(false);
            panel_SOS.setVisible(false);
            panel_Gestion.setVisible(true);
        }

    }//GEN-LAST:event_boton_GestionMouseMoved

    private void boton_CallCenterMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boton_CallCenterMousePressed
        // TODO add your handling code here:
        if (!panel_Login.isVisible()) {
            if (panel_Login.getClaseUsuario() == null || !panel_Login.getClaseUsuario().equalsIgnoreCase(Administrador.class.getName())) {
                JOptionPane.showMessageDialog(null, "Solo el administrador puede editar y visualizar usuarios");
            }
        }
    }//GEN-LAST:event_boton_CallCenterMousePressed

    private void boton_LoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boton_LoginActionPerformed
        // TODO add your handling code here:
        panel_CallCenter.setVisible(false);
        panel_SOS.setVisible(false);
        panel_Gestion.setVisible(false);
        panel_Login.setVisible(true);
    }//GEN-LAST:event_boton_LoginActionPerformed

    private void boton_GestionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boton_GestionActionPerformed
        // TODO add your handling code here:
        
        GestorEstadisticas g=new GestorEstadisticas();
        try {
            g.crearGrafico();
        } catch (SQLException ex) {
            //Logger.getLogger(Panel_Inicio.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }//GEN-LAST:event_boton_GestionActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton boton_CallCenter;
    private javax.swing.JButton boton_Gestion;
    private javax.swing.JButton boton_Login;
    private javax.swing.JButton boton_SOS;
    // End of variables declaration//GEN-END:variables
}
